home *** CD-ROM | disk | FTP | other *** search
- /******************************************************************************
- *
- * NSSDC/CDF Utility routines in CDF toolbox.
- *
- * Version 2.0, 27-Feb-92, ST Systems (STX)
- *
- * Modification history:
- *
- * V1.0 24-Jan-91, D Grogan/H Leckner Original version (for CDF V2.0).
- * V1.1 28-Jun-91, J Love TRUE/FALSE.
- * V2.0 27-Feb-92, J Love Modified for IBM-PC port. CDF V2.2.
- * H Leckner
- *
- ******************************************************************************/
-
- #include <stdlib.h>
- #include <stdio.h>
-
- #include "cdfdist.h"
-
- /*
- C_UTIL.c
-
- This is a collection of utility routines used in the CDF tool box.
-
- */
-
- void set_pointer ( ptr_out, ptr_in )
-
- long int *ptr_out;
- long int ptr_in;
- {
-
- *ptr_out = ptr_in;
-
- }
-
- void left_justify (field, len)
- char field[];
- int len;
- {
- long int i;
- long int index;
- long int done;
- char *temp;
-
- temp = (char *) malloc(len);
-
- /* Blank out temporary hold area */
-
- for (i = 0; i < len; i++)
- temp[i] = ' ';
-
-
- done = FALSE;
- for (index = 0; done != TRUE && index <= len; index++)
-
- {
- /* Look for a non-blank character */
-
- if(field[index] != ' ')
- {
- /* Left Justify by copying from the non-blank character to the end of field */
-
- strncpy(temp,field+index,len-index);
- for (i = 0; i < len; i++)
- field[i] = ' ';
-
- /* Now copy from the temporary field back to the permanent field */
-
- strncpy(field, temp, len);
- done = TRUE;
- }
- }
- free(temp);
-
- } /* end left_justify */
-